package cn.weiron.fun.infrastructure.utils;

import java.util.Random;

/**
 * 随机任务码生成器
 */
public class RandomUtil {
    /**
     * 随机盐的文本库
     */
    private static final String[] wordbook = new String[]{
            "0", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "K", "L", "M", "P", "S", "T", "U", "W", "Z"
    };

    /**
     * 生成长度（默认6）
     */
    private static final Integer contentLength = 6;

    /**
     * 生成六位的随机任务码
     */
    public static String taskCode(){
        StringBuilder code = new StringBuilder();
        Random random=new Random();
        for (int i = 0; i < contentLength; i++) {
            code.append(wordbook[random.nextInt(wordbook.length - 1)]);
        }
        return code.toString();
    }
}